#!/usr/local/bin/python2.7
# encoding: utf-8
'''
NervuresDesignTool -- Outil de conception/simulation de parapentes Nervures

Classe xxx
Description :
@module : utilitaires.version
@author:      puiseux
@copyright:   2013 Nervures. All rights reserved.      
@license:    LGPL
@contact:    be@nervures.com, pierre@puiseux.name
@deffield    creation: 16 mars 2013
'''
import sys, os
class Versions():
    def __init__(self):
        import PySide
#         import enthought, enthought.tvtk
#         import os, sys, scipy, numpy, platform
        import os, sys, numpy, platform
        dversions = {}
        dversions['1. Plateforme  '] =  sys.platform
        dversions['2. Python      '] = platform.python_version()
#         dversions['3. PySide      '] = PySide.__version__
    #    print 'enthought.__version__', enthought.__version__
#         dversions['4. scipy       '] = scipy.version.version
        dversions['5. numpy       '] = numpy.version.version
        self.dversions = dversions
        dpaths = {}
#        dpaths['Python        '] = os.environ['PYTHONPATH']
        dpaths['1. Python        '] = sys.executable
#         dpaths['2. PySide        '] = PySide.__path__
        dpaths['3. NumPy         '] = numpy.__path__
#         dpaths['4. SciPy         '] = scipy.__path__
#         dpaths['5. Enthought     '] = enthought.__path__
#         dpaths['6. enthought.tvtk'] = enthought.tvtk.__path__
#        dpaths['7. enthought.tvtk'] = enthought.tvtk.__path__
        self.dpaths = dpaths
        
    def __str__(self):
        
        lstring = [30*'#'+'\n#### Nervures Design Tool ####\n'+30*'#']
        
        lstring.extend(['####### versions #######', self.versions(), 
                        '#######   paths  #######', self.paths()])
        
        return '\n\n'.join(lstring)
    
    def paths(self):
        stringlist=[]
        for key, value in sorted(self.dpaths.iteritems()) :
            stringlist.append('%s : %s'%(key, str(value)))
        return '\n'.join(stringlist)
    
    def versions(self):
        stringlist=[]
        for key, value in sorted(self.dversions.iteritems()) :
            stringlist.append('%s : %s'%(key, str(value)))
        return '\n'.join(stringlist)
        
    
if __name__ == '__main__':
   print Versions()